﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using 强类型DataSet1.DataSetPersonsTableAdapters;

namespace 强类型DataSet1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            T_PersonsTableAdapter adapter = new T_PersonsTableAdapter();
           /* 强类型DataSet1.DataSetPersons.T_PersonsDataTable persons = adapter.GetData();
            for (int i = 0; i < persons.Count; i++)
            {
                强类型DataSet1.DataSetPersons.T_PersonsRow person = persons[i];
                string msg = string.Format("姓名：{0}，年龄：{1}", person.Name, person.Age);
                MessageBox.Show(msg);
            }

            persons[0].Name = "kobe";
            adapter.Update(persons);*/
           // adapter.Insert("bulate", 27);
            adapter.Delete(4,"bulate", 27);

        }

        private void button2_Click(object sender, EventArgs e)
        {
            T_PersonsTableAdapter adapter = new T_PersonsTableAdapter();
            强类型DataSet1.DataSetPersons.T_PersonsDataTable datatable = adapter.GetDataOlder();
            for (int i = 0; i < datatable.Count; i++)
            {
                强类型DataSet1.DataSetPersons.T_PersonsRow row = datatable[i];
                if (row.IsNameNull())
                {
                    MessageBox.Show("值为空");
                }
                else
                {
                    MessageBox.Show(row.Name);
                }
             }
        }
    }
}
